#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5+1000;
typedef int LL;
inline LL read(){LL x= 0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
multiset<LL>s;
multiset<LL>g[maxn];
LL vis[maxn];
void bfs(LL x){
    s.erase(x);
    vis[x]=true;
    queue<LL>que;
    que.push(x);
    while(!que.empty()){
        LL u=que.front();que.pop();
        for(auto it=s.begin();it!=s.end();){
            LL v=*it++;
            if(!g[u].count(v)){
                s.erase(v);
                que.push(v);
                vis[v]=true;
            }
        }
    }
}
int main(void){
   LL n,m;n=read();m=read();
   for(LL i=1;i<=n;i++) s.insert(i);
   for(LL i=1;i<=m;i++){
      LL u,v;u=read();v=read();
      g[u].insert(v);g[v].insert(u);
   }
   LL ans=0;
   for(LL i=1;i<=n;i++){
      if(!vis[i]){
         ans++;
         bfs(i);
      }
   }
   printf("%d\n",ans-1);
   return 0;
}
